Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added stats charts in xy-chart #75

Merged
merged 9 commits into from
Nov 16, 2017

Conversation

conglei
Copy link
Collaborator

@conglei conglei commented Nov 14, 2017

This PR

  • adds <ViolinPlotSeries/> and example
  • adds <BoxPlotSeries/> and example
  • bumps @vx-mock-data to 0.0.147 for stats data generation

TODO

  • update README
  • test renderTooltips to series
  • add testing files for two new series

boxplot

@coveralls
Copy link

coveralls commented Nov 14, 2017

Coverage Status

Coverage decreased (-1.9%) to 81.257% when pulling 8351254 on conglei:conglei-stats-xychart into de7642e on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+1.2%) to 84.373% when pulling 14ce771 on conglei:conglei-stats-xychart into de7642e on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+1.2%) to 84.373% when pulling 8ca71ab on conglei:conglei-stats-xychart into de7642e on williaster:master.

Copy link
Owner

@williaster williaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor comments mostly based on changes I've been making recently. This looks fantastic overall, thanks for adding it! 💯 🎉

@@ -15,6 +15,8 @@ import {
LineSeries,
PointSeries,
StackedBarSeries,
BoxPlotSeries,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this file is getting so big I think it'd be good to start moving the examples into their own files. I did this with <StackedAreaSeries />, could we do that here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good! I moved them out as a separate file

description: 'Box Plot Example',
example: () => {
const boxPlotData = statsData.map(s => s.boxPlot);
const values = boxPlotData.reduce((r, e) => r.push(e.min, e.max, ...e.outliers) && r, []);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice concise way to write this 👌

<YAxis numTicks={4} />
<BoxPlotSeries
data={boxPlotData}
label="Test"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the label prop earlier this week! unnecessary now :)

/>
<BoxPlotSeries
data={boxPlotData}
label="Test"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto label

<YAxis numTicks={4} />
<ViolinPlotSeries
data={violinData}
label="Test"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto label

@@ -0,0 +1,88 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Group } from '@vx/group';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto absolute imports

const offsetValue = horizontal ? y : x;
const valueScale = horizontal ? xScale : yScale;
const boxWidth = offsetScale.bandwidth();
const actualyWidth = Math.min(MAX_BOX_WIDTH, boxWidth);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit actualWidth?


const propTypes = {
data: violinPlotSeriesDataShape.isRequired,
label: PropTypes.string.isRequired,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could remove this


const defaultProps = {
boxWidth: null,
stroke: '#000000',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use colors.darkGray or colors.black which aren't quiiiite black. most designers have told me to never use pure black ... some dark gray instead is more visually appealing.

const offsetValue = horizontal ? y : x;
const valueScale = horizontal ? xScale : yScale;
const boxWidth = offsetScale.bandwidth();
const actualyWidth = Math.min(MAX_BOX_WIDTH, boxWidth);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit -- actualWidth?


import { boxPlotSeriesDataShape } from '../utils/propShapes';

const propTypes = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for renderTooltip you'll have to add onMouseMove, onMouseLeave, and onClick handlers here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! done

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+1.03%) to 84.238% when pulling c979ae1 on conglei:conglei-stats-xychart into de7642e on williaster:master.

@conglei conglei force-pushed the conglei-stats-xychart branch from c979ae1 to 6fbc442 Compare November 15, 2017 18:36
@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage decreased (-0.08%) to 84.102% when pulling 6fbc442 on conglei:conglei-stats-xychart into 6174372 on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+0.06%) to 84.238% when pulling beaa221 on conglei:conglei-stats-xychart into 6174372 on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+0.06%) to 84.238% when pulling 3600eba on conglei:conglei-stats-xychart into 6174372 on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage decreased (-0.4%) to 83.801% when pulling bdb21a6 on conglei:conglei-stats-xychart into 6174372 on williaster:master.

@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage decreased (-0.4%) to 83.801% when pulling eaf230d on conglei:conglei-stats-xychart into 6174372 on williaster:master.

1 similar comment
@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage decreased (-0.4%) to 83.801% when pulling eaf230d on conglei:conglei-stats-xychart into 6174372 on williaster:master.

@williaster
Copy link
Owner

dope! thanks for adding this 💯 should be able to cut a release later today

@williaster williaster merged commit f5d4f42 into williaster:master Nov 16, 2017
@williaster williaster mentioned this pull request Nov 16, 2017
@williaster williaster added this to the v0.0.49 milestone Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants